//
//  OrderDetaileTableViewCell.m
//  mhome
//
//  Created by 刘春雷 on 2018/12/5.
//  Copyright © 2018年 刘春雷. All rights reserved.
//

#import "OrderDetaileTableViewCell.h"

@interface OrderDetaileTableViewCell()
@property (nonatomic,strong) UIImageView *image;  //地址图标
@end

@implementation OrderDetaileTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self initUI];
    }
    return self;
}
- (void)initUI {
    self.image = [[UIImageView alloc]init];
    [self addSubview:self.image];
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(14);
        make.left.mas_equalTo(self.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(15*kWidthScale, 17*kHeightScale));
    }];
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(16);
        make.left.mas_equalTo(self.image.mas_right).offset(5);
        make.size.mas_equalTo(CGSizeMake(110*kWidthScale, 14*kHeightScale));
    }];
    
    self.contentLabel = [[UILabel alloc]init];
    self.contentLabel.font = [UIFont systemFontOfSize:13.0];
    self.contentLabel.textAlignment = NSTextAlignmentRight;
    self.contentLabel.textColor = [UIColor grayColor];
    [self addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(16);
        make.left.mas_equalTo(self.titleLabel.mas_right).offset(0);
        make.size.mas_equalTo(CGSizeMake(230*kWidthScale, 14*kHeightScale));
    }];
}
- (void)setOrderDetaileData:(orderModel *)cellModel {
   NSArray *array = @[@"预约人",@"联系方式",@"预约时间",@"装修区域"];
    NSLog(@"======%@",cellModel);
    self.image.image = [UIImage imageNamed:array[cellModel.indexpath.row]];
    self.titleLabel.text = array[cellModel.indexpath.row];
    switch (cellModel.indexpath.row) {
        case 0:
        self.contentLabel.text = cellModel.ownerName;
        break;
        case 1:
        self.contentLabel.text = cellModel.ownerMobile;
        break;
        case 2:
        self.contentLabel.text = cellModel.createTimeOfYX;
        break;
        case 3:
        self.contentLabel.text = [NSString stringWithFormat:@"%@%@%@",cellModel.province,cellModel.city,cellModel.area];
        break;
        
        default:
        break;
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
